<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Getting started with App Runner</title>
    <link rel="stylesheet" href="site.css">
</head>
<body>

<header th:replace="base.html :: header"></header>

<main>

    <h2>Getting started</h2>

    <h3>Step 1: Create an application</h3>

    <p>App Runner builds, deploys and runs web applications. When it starts your app, it will pass in the following
        environment variables:</p>
    <ul>
        <li><code>APP_PORT</code> - a port to host a web server on</li>
        <li><code>APP_NAME</code> - the path your web service must serve requests on, i.e. <code>http://localhost:{APP_PORT}/{APP_NAME}/*</code>
        </li>
        <li><code>APP_DATA</code> - a directory path where you can store data</li>
        <li><code>TEMP</code> - a path to a temp folder</li>
    </ul>

    <p>There are a number of sample apps to get you started:</p>
    <ul>
        <li th:each="sample : ${samples}"><strong><a href="sample.zip" th:href="${sample.url}" th:text="${sample.name}">name</a></strong>
            - <span th:text="${sample.description}">description</span>
            <p>Apps of this kind are built and run with:
                <code th:each="command : ${sample.runCommands}"><br><span th:text="${command}">command</span></code>
            </p>
        </li>
    </ul>

    <h3>Step 2: Prepare a Git Repo</h3>

    <p>Push your app to a Git server such as GitHub or an internal Git Server. App Runner needs to have read access
        to your repository - HTTP/HTTPS URLs should allow anonymous access. For SSH URLs, the repository needs to have
        the App Runner server's public key associated with it.</p>

    <p>The public key of the App Runner server is:</p>
    <div th:each="publicKey : ${publicKeys}">
        <blockquote th:text="*{publicKey}?: '(public key not detected)'"
                        style="word-wrap: break-word; background-color:#DDDDDD;padding:10px;font-family: 'Courier New',monospace;">
            KEY
        </blockquote>
    </div>

    <h3>Step 3: Register and deploy your app</h3>

    <p>Both these steps can be done with the REST API:</p>
    <ul>
        <li><a href="/app-runner-home/docs/api.html#!/Application/create">Register</a></li>
        <li><a href="/app-runner-home/docs/api.html#!/Application/deploy">Deploy</a></li>
    </ul>

    <p>To automatically deploy changes, set up a post-commit hook in your GIT server POSTing to <code>/api/v1/apps/((your app name))/deploy</code></p>

</main>

<footer th:replace="base.html :: footer"></footer>

</body>
</html>
